1
|
|
|
import React, { Component, Fragment } from "react" |
2
|
|
|
import { graphql } from "gatsby" |
3
|
|
|
|
4
|
|
|
import Layout from "../layouts/index" |
5
|
|
|
|
6
|
|
|
import SEO from "../components/seo" |
7
|
|
|
import MetaMatches from "../components/meta-matches" |
8
|
|
|
import MatchesOverview from "../components/matches-overview" |
9
|
|
|
import MatchesSlider from "../components/matches-slider" |
10
|
|
|
import { |
11
|
|
|
NewsItemFeatured, |
12
|
|
|
NewsItemCardRatio, |
13
|
|
|
KcvvTvCard, |
14
|
|
|
} from "../components/news-item" |
15
|
|
|
import { CardImage } from "../components/cards" |
16
|
|
|
import UpcomingEvent from "../components/upcoming-event" |
17
|
|
|
import PlayerFeatured from "../components/player--featured" |
18
|
|
|
|
19
|
|
|
import MyMakro from "../images/mymakrokcvv.jpg" |
20
|
|
|
|
21
|
|
|
class IndexPage extends Component { |
22
|
|
|
renderMatchSlider = () => ( |
23
|
|
|
<section className={"grid-container full"}> |
24
|
|
|
<MatchesSlider season="1920" regnumber="00055" /> |
25
|
|
|
</section> |
26
|
|
|
) |
27
|
|
|
renderSocialMediaArticle = () => ( |
28
|
|
|
<article className={"medium-6 large-12 cell social"}> |
29
|
|
|
<div className={"social-sidebar__wrapper"}> |
30
|
|
|
<a |
31
|
|
|
href="https://facebook.com/KCVVElewijt" |
32
|
|
|
className="btn-social-counter btn-social-counter--fb" |
33
|
|
|
target="_blank" |
34
|
|
|
rel="noopener noreferrer" |
35
|
|
|
> |
36
|
|
|
<div className="btn-social-counter__icon"> |
37
|
|
|
<i className="fa fa-facebook"></i> |
38
|
|
|
</div> |
39
|
|
|
<h5 className="btn-social-counter__title"> |
40
|
|
|
Volg onze Facebook pagina |
41
|
|
|
</h5> |
42
|
|
|
</a> |
43
|
|
|
<a |
44
|
|
|
href="https://twitter.com/kcvve" |
45
|
|
|
className="btn-social-counter btn-social-counter--twitter" |
46
|
|
|
target="_blank" |
47
|
|
|
rel="noopener noreferrer" |
48
|
|
|
> |
49
|
|
|
<div className="btn-social-counter__icon"> |
50
|
|
|
<i className="fa fa-twitter"></i> |
51
|
|
|
</div> |
52
|
|
|
<h5 className="btn-social-counter__title">Volg ons op Twitter</h5> |
53
|
|
|
</a> |
54
|
|
|
<a |
55
|
|
|
href="http://www.instagram.com/kcvve" |
56
|
|
|
className="btn-social-counter btn-social-counter--instagram" |
57
|
|
|
target="_blank" |
58
|
|
|
rel="noopener noreferrer" |
59
|
|
|
> |
60
|
|
|
<div className="btn-social-counter__icon"> |
61
|
|
|
<i className="fa fa-instagram"></i> |
62
|
|
|
</div> |
63
|
|
|
<h5 className="btn-social-counter__title">Volg ons op Instagram</h5> |
64
|
|
|
</a> |
65
|
|
|
</div> |
66
|
|
|
</article> |
67
|
|
|
) |
68
|
|
|
renderMakroArticle = () => ( |
69
|
|
|
<article className={"medium-6 large-12 cell card"}> |
70
|
|
|
<header className={"card__header"}> |
71
|
|
|
<h4>MyMakro</h4> |
72
|
|
|
</header> |
73
|
|
|
<div className={"card__content"}> |
74
|
|
|
<p> |
75
|
|
|
Link nu jouw Makro voordeelkaart aan onze vereniging. Bij elke aankoop |
76
|
|
|
bij Makro en partners steun je KCVV Elewijt! |
77
|
|
|
</p> |
78
|
|
|
<p> |
79
|
|
|
<img src={MyMakro} alt="QR Code MyMakro" style={{ width: "100%" }} /> |
80
|
|
|
</p> |
81
|
|
|
<p> |
82
|
|
|
Scan bovenstaande QR-code met je camera op GSM, of surf naar{" "} |
83
|
|
|
<a |
84
|
|
|
href="https://my.makro.be/nl/link-vereniging/02277464" |
85
|
|
|
target="_blank" |
86
|
|
|
rel="noopener noreferrer" |
87
|
|
|
title="MyMakro link voor KCVV Elewijt" |
88
|
|
|
className={"rich-link"} |
89
|
|
|
> |
90
|
|
|
https://my.makro.be/nl/link-vereniging/02277464 |
91
|
|
|
</a> |
92
|
|
|
. |
93
|
|
|
</p> |
94
|
|
|
<p>Onze vereniging dankt jullie van harte!</p> |
95
|
|
|
</div> |
96
|
|
|
</article> |
97
|
|
|
) |
98
|
|
|
renderYouthCalendarArticle = () => ( |
99
|
|
|
<article className={"medium-6 large-12 cell card"}> |
100
|
|
|
<header className="card__header"> |
101
|
|
|
<h4>Jeugdploegen</h4> |
102
|
|
|
</header> |
103
|
|
|
<MatchesOverview season="1920" regnumber="00055" exclude="['2A', '4D']" /> |
104
|
|
|
</article> |
105
|
|
|
) |
106
|
|
|
|
107
|
|
|
renderBTeamCalendarArticle = () => ( |
108
|
|
|
<article className={"medium-6 large-12 cell card"}> |
109
|
|
|
<header className={"card__header"}> |
110
|
|
|
<h4>The B-Team</h4> |
111
|
|
|
</header> |
112
|
|
|
<MetaMatches season="1920" region="bra" division="4D" regnumber="00055" /> |
113
|
|
|
</article> |
114
|
|
|
) |
115
|
|
|
renderATeamCalendarArticle = () => ( |
116
|
|
|
<article className={"medium-6 large-12 cell card"}> |
117
|
|
|
<header className={"card__header"}> |
118
|
|
|
<h4>The A-Team</h4> |
119
|
|
|
</header> |
120
|
|
|
<MetaMatches season="1920" region="bra" division="2A" regnumber="00055" /> |
121
|
|
|
</article> |
122
|
|
|
) |
123
|
|
|
|
124
|
|
|
renderWebsiteFeedbackArticle = () => ( |
125
|
|
|
<article className={"medium-6 large-12 cell card"}> |
126
|
|
|
<header className={"card__header"}> |
127
|
|
|
<h4> |
128
|
|
|
<i className={"fa fa-commenting-o"} aria-hidden="true"></i> Website |
129
|
|
|
feedback |
130
|
|
|
</h4> |
131
|
|
|
</header> |
132
|
|
|
<div className={"card__content"}> |
133
|
|
|
<p> |
134
|
|
|
Na lang zwoegen is onze nieuwe website eíndelijk online geraakt! We |
135
|
|
|
zijn heel benieuwd naar jullie mening of feedback. Als jullie vinden |
136
|
|
|
dat er iets ontbreekt, of als je bepaalde fouten tegenkomt, zouden we |
137
|
|
|
het ten zeerste appreciëren als je ons even iets laat weten op{" "} |
138
|
|
|
<a href="mailto:[email protected]" className={"rich-link"}> |
139
|
|
|
[email protected] |
140
|
|
|
</a> |
141
|
|
|
! |
142
|
|
|
</p> |
143
|
|
|
</div> |
144
|
|
|
</article> |
145
|
|
|
) |
146
|
|
|
renderExtraContentFooter = () => ( |
147
|
|
|
<> |
148
|
|
|
{/* <section className="grid-container site-content"> |
149
|
|
|
<div className="grid-x grid-margin-x"> |
150
|
|
|
<section className={'cell large-12 featured-article'}> |
151
|
|
|
<CardImage |
152
|
|
|
title="Voorbereidings- en bekerwedstrijden" |
153
|
|
|
localFile={data.preseason} |
154
|
|
|
link="/games" |
155
|
|
|
metadata={false} |
156
|
|
|
/> |
157
|
|
|
</section> |
158
|
|
|
</div> |
159
|
|
|
</section> */} |
160
|
|
|
</> |
161
|
|
|
) |
162
|
|
|
|
163
|
|
|
convertGraphqlToPlayerObject = player => { |
164
|
|
|
return { |
165
|
|
|
nameFirst: player.field_firstname, |
166
|
|
|
nameLast: player.field_lastname, |
167
|
|
|
shirtNr: player.field_shirtnumber, |
168
|
|
|
position: player.field_position, |
169
|
|
|
gamesPlayed: player.field_stats_games, |
170
|
|
|
cleanSheets: player.field_stats_cleansheets, |
171
|
|
|
goalsScored: player.field_stats_goals, |
172
|
|
|
cardsYellow: player.field_stats_cards_yellow, |
173
|
|
|
cardsRed: player.field_stats_cards_red, |
174
|
|
|
imageSrc: |
175
|
|
|
player.relationships.field_image.localFile.childImageSharp.fixed.src, |
176
|
|
|
link: player.path.alias, |
177
|
|
|
} |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
renderPlayerOfTheWeek = featuredPlayer => |
181
|
|
|
featuredPlayer.edges.map( |
182
|
|
|
({ node: potw }) => |
183
|
|
|
potw.relationships.field_player && ( |
184
|
|
|
<article |
185
|
|
|
className={"medium-6 large-12 cell card"} |
186
|
|
|
key={potw.relationships.field_player.field_firstname} |
187
|
|
|
> |
188
|
|
|
<header className={"card__header"}> |
189
|
|
|
<h4>Speler van de week</h4> |
190
|
|
|
</header> |
191
|
|
|
<PlayerFeatured |
192
|
|
|
player={this.convertGraphqlToPlayerObject( |
193
|
|
|
potw.relationships.field_player |
194
|
|
|
)} |
195
|
|
|
/> |
196
|
|
|
</article> |
197
|
|
|
) |
198
|
|
|
) |
199
|
|
|
|
200
|
|
|
renderPosts = posts => { |
201
|
|
|
let articleCount = 0 |
202
|
|
|
let kcvvTvCount = 0 |
203
|
|
|
|
204
|
|
|
return posts.map(({ node }, i) => { |
205
|
|
|
switch (node.internal.type) { |
206
|
|
|
case "node__article": |
207
|
|
|
node.field_featured && (articleCount = articleCount + 2) |
208
|
|
|
!node.field_featured && articleCount++ |
209
|
|
|
return ( |
210
|
|
|
<Fragment key={i}> |
211
|
|
|
{node.field_featured && <NewsItemFeatured node={node} />} |
212
|
|
|
{!node.field_featured && ( |
213
|
|
|
<NewsItemCardRatio node={node} teaser={true} /> |
214
|
|
|
)} |
215
|
|
|
</Fragment> |
216
|
|
|
) |
217
|
|
|
case "node__kcvv_tv": |
218
|
|
|
if (kcvvTvCount === 0) { |
219
|
|
|
articleCount = articleCount + 2 |
220
|
|
|
kcvvTvCount++ |
221
|
|
|
return ( |
222
|
|
|
<CardImage |
223
|
|
|
title={node.title} |
224
|
|
|
localFile={ |
225
|
|
|
node.relationships.field_media_article_image.relationships |
226
|
|
|
.field_media_image.localFile |
227
|
|
|
} |
228
|
|
|
link={node.field_website.uri} |
229
|
|
|
metadata={false} |
230
|
|
|
key={i} |
231
|
|
|
/> |
232
|
|
|
) |
233
|
|
|
} else { |
234
|
|
|
articleCount = articleCount + 2 |
235
|
|
|
kcvvTvCount++ |
236
|
|
|
return <KcvvTvCard node={node} teaser={true} key={i} /> |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
default: |
240
|
|
|
return "" |
241
|
|
|
} |
242
|
|
|
}) |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
combineAndSortPosts = (featuredPosts, kcvvTv) => { |
246
|
|
|
return [...featuredPosts.edges, ...kcvvTv.edges].sort((a, b) => |
247
|
|
|
a.node.timestamp < b.node.timestamp |
248
|
|
|
? 1 |
249
|
|
|
: b.node.timestamp < a.node.timestamp |
250
|
|
|
? -1 |
251
|
|
|
: 0 |
252
|
|
|
) |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
renderLayoutSidebar = () => { |
256
|
|
|
const { featuredPlayer } = this.props.data |
257
|
|
|
return ( |
258
|
|
|
<> |
259
|
|
|
{/* A TEAM OVERVIEW - SUMMARY OF MATCHES AND RANKING*/} |
260
|
|
|
{this.renderATeamCalendarArticle()} |
261
|
|
|
|
262
|
|
|
{/* B TEAM OVERVIEW - SUMMARY OF MATCHES AND RANKING */} |
263
|
|
|
{this.renderBTeamCalendarArticle()} |
264
|
|
|
|
265
|
|
|
{/* YOUTH TEAMS OVERVIEW - SUMMARY OF UPCOMING MATCHES */} |
266
|
|
|
{this.renderYouthCalendarArticle()} |
267
|
|
|
|
268
|
|
|
{/* PLAYER OF THE WEEK ARTICLE IF ANY */} |
269
|
|
|
{featuredPlayer && this.renderPlayerOfTheWeek(featuredPlayer)} |
270
|
|
|
|
271
|
|
|
{/* INFO ARTICLE WITH SOCIAL MEDIA LINKS */} |
272
|
|
|
{this.renderSocialMediaArticle()} |
273
|
|
|
|
274
|
|
|
{/* INFO ARTICLE WITH REQUEST FOR WEBSITE FEEDBACK */} |
275
|
|
|
{this.renderWebsiteFeedbackArticle()} |
276
|
|
|
|
277
|
|
|
{/* INFO ARTICLE WITH "MYMAKRO" CONTENT */} |
278
|
|
|
{this.renderMakroArticle()} |
279
|
|
|
</> |
280
|
|
|
) |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
renderLayoutMain = () => { |
284
|
|
|
const { featuredPosts, kcvvTv } = this.props.data |
285
|
|
|
const posts = this.combineAndSortPosts(featuredPosts, kcvvTv) |
286
|
|
|
|
287
|
|
|
return ( |
288
|
|
|
<> |
289
|
|
|
<UpcomingEvent /> |
290
|
|
|
|
291
|
|
|
{posts && this.renderPosts(posts)} |
292
|
|
|
</> |
293
|
|
|
) |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
render() { |
297
|
|
|
return ( |
298
|
|
|
<Layout> |
299
|
|
|
<SEO lang="nl-BE" title="Er is maar één plezante compagnie" /> |
300
|
|
|
|
301
|
|
|
<section className="grid-container site-content"> |
302
|
|
|
<div className="grid-x grid-margin-x"> |
303
|
|
|
<section className="cell large-8 news_overview__wrapper"> |
304
|
|
|
{/* MAIN CONTENT AREA */} |
305
|
|
|
{this.renderLayoutMain()} |
306
|
|
|
</section> |
307
|
|
|
<aside className="cell large-4"> |
308
|
|
|
<section className="grid-x featured__matches grid-margin-x"> |
309
|
|
|
{/* SIDEBAR CONTENT */} |
310
|
|
|
{this.renderLayoutSidebar()} |
311
|
|
|
</section> |
312
|
|
|
</aside> |
313
|
|
|
</div> |
314
|
|
|
</section> |
315
|
|
|
|
316
|
|
|
{/* FULL-WIDTH SLICK SLIDER WITH UPCOMING MATCHES */} |
317
|
|
|
{this.renderMatchSlider()} |
318
|
|
|
|
319
|
|
|
{/* LIMITED-WIDTH CONTAINER WITH EXTRA (STICKY) CONTENT, IF ANY */} |
320
|
|
|
{this.renderExtraContentFooter()} |
321
|
|
|
</Layout> |
322
|
|
|
) |
323
|
|
|
} |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
export const pageQuery = graphql` |
327
|
|
|
query { |
328
|
|
|
featuredPosts: allNodeArticle( |
329
|
|
|
filter: { status: { eq: true }, promote: { eq: true } } |
330
|
|
|
sort: { fields: changed, order: DESC } |
331
|
|
|
limit: 10 |
332
|
|
|
) { |
333
|
|
|
edges { |
334
|
|
|
node { |
335
|
|
|
id |
336
|
|
|
path { |
337
|
|
|
alias |
338
|
|
|
} |
339
|
|
|
created(formatString: "D/M/YYYY") |
340
|
|
|
changed(formatString: "D/M/YYYY") |
341
|
|
|
timestamp: changed(formatString: "x") |
342
|
|
|
title |
343
|
|
|
promote |
344
|
|
|
status |
345
|
|
|
field_featured |
346
|
|
|
body { |
347
|
|
|
value |
348
|
|
|
format |
349
|
|
|
processed |
350
|
|
|
summary |
351
|
|
|
} |
352
|
|
|
relationships { |
353
|
|
|
field_media_article_image { |
354
|
|
|
...ArticleImage |
355
|
|
|
} |
356
|
|
|
field_tags { |
357
|
|
|
name |
358
|
|
|
path { |
359
|
|
|
alias |
360
|
|
|
} |
361
|
|
|
} |
362
|
|
|
} |
363
|
|
|
internal { |
364
|
|
|
type |
365
|
|
|
} |
366
|
|
|
} |
367
|
|
|
} |
368
|
|
|
} |
369
|
|
|
preseason: file(name: { eq: "preseason" }) { |
370
|
|
|
...KCVVFluid960 |
371
|
|
|
} |
372
|
|
|
kcvvTv: allNodeKcvvTv( |
373
|
|
|
filter: { status: { eq: true }, promote: { eq: true } } |
374
|
|
|
sort: { fields: created, order: DESC } |
375
|
|
|
limit: 5 |
376
|
|
|
) { |
377
|
|
|
edges { |
378
|
|
|
node { |
379
|
|
|
id |
380
|
|
|
created(formatString: "D/M/YYYY") |
381
|
|
|
title |
382
|
|
|
timestamp: created(formatString: "x") |
383
|
|
|
relationships { |
384
|
|
|
field_media_article_image { |
385
|
|
|
...ArticleImage |
386
|
|
|
} |
387
|
|
|
} |
388
|
|
|
field_website { |
389
|
|
|
uri |
390
|
|
|
} |
391
|
|
|
internal { |
392
|
|
|
type |
393
|
|
|
} |
394
|
|
|
} |
395
|
|
|
} |
396
|
|
|
} |
397
|
|
|
featuredPlayer: allNodePotw( |
398
|
|
|
sort: { fields: created, order: DESC } |
399
|
|
|
filter: { status: { eq: true } } |
400
|
|
|
limit: 1 |
401
|
|
|
) { |
402
|
|
|
edges { |
403
|
|
|
node { |
404
|
|
|
relationships { |
405
|
|
|
field_player { |
406
|
|
|
field_firstname |
407
|
|
|
field_lastname |
408
|
|
|
field_shirtnumber |
409
|
|
|
field_stats_games |
410
|
|
|
field_position |
411
|
|
|
field_stats_cleansheets |
412
|
|
|
field_stats_goals |
413
|
|
|
field_stats_cards_yellow |
414
|
|
|
field_stats_cards_red |
415
|
|
|
relationships { |
416
|
|
|
field_image { |
417
|
|
|
localFile { |
418
|
|
|
...KCVVFixedPlayerTeaser |
419
|
|
|
} |
420
|
|
|
} |
421
|
|
|
} |
422
|
|
|
path { |
423
|
|
|
alias |
424
|
|
|
} |
425
|
|
|
} |
426
|
|
|
} |
427
|
|
|
} |
428
|
|
|
} |
429
|
|
|
} |
430
|
|
|
} |
431
|
|
|
` |
432
|
|
|
|
433
|
|
|
export default IndexPage |
434
|
|
|
|